package com.qf.manager.service.impl;

import com.qf.manager.dao.UserMapper;
import com.qf.manager.pojo.po.User;
import com.qf.manager.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public User getUserByUid(Long uid) {
        return userMapper.selectByPrimaryKey(uid);
    }

    @Override
    public List<User> getUsers() {
        return userMapper.selectByExample(null);
    }

    @Override
    public int deleteUserByUid(Long uid) {
        return userMapper.deleteByPrimaryKey(uid);
    }

    @Override
    public int insertUser(User user) {
        return userMapper.insert(user);
    }

    @Override
    public int updateUserByUid(User user) {
        return userMapper.updateByPrimaryKeySelective(user);
    }
}
